package com.bootdo.common.task;

import com.alibaba.fastjson.JSON;
import com.bootdo.provider.service.GoodsInfoService;
import com.bootdo.put.domain.PutStorageDO;
import com.bootdo.put.service.PutStorageDetailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by clq on 2018/5/7
 */
@Component
public class Timing {


    @Autowired
    private GoodsInfoService goodsInfoService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private PutStorageDetailService putStorageDetailService;

    @Scheduled(cron="0 0/10 * * * ?") //每分钟执行一次
    public void statusCheck() {
        logger.info("每10分钟执行一次。开始……");
        //statusTask.healthCheck();
        System.out.println(JSON.toJSON(goodsInfoService.get(1L)));

        logger.info("每10分钟执行一次。结束。");
    }

    @Scheduled(fixedRate=20000*60)
    public void testTasks() {
        logger.info("每20秒执行一次。开始……");
       // statusTask.healthCheck();
        logger.info("每20秒执行一次。结束。");

    }



}
